<%@ Page Title="Resumes" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" 
	Inherits="System.Web.Mvc.ViewPage<IEnumerable<ETestIT.Core.Resume>>" %>
<%@ Import Namespace="ETestIT.Core" %>
<%@ Import Namespace="ETestIT.Web.Controllers" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentTitlePlaceHolder" runat="server">
    <h2>Resumes</h2>
</asp:Content>

<asp:Content ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <% if (ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] != null) { %>
        <p id="pageMessage"><%= ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()]%></p>
    <% } %>

    <table>
        <thead>
            <tr>
			    <th>Name</th>
			    <th>Version</th>
			    <th colspan="3">Action</th>
            </tr>
        </thead>

		<%
		foreach (Resume resume in ViewData.Model) { %>
			<tr>
				<td><%= Html.ActionLink<ResumesController>(c => c.Download(resume.Id), resume.Name)%></td>
				<td><%= resume.Version %></td>
				<td>
    				<% using (Html.BeginForm<ResumesController>(c => c.Delete(resume.Id))) { %>
                        <%= Html.AntiForgeryToken() %>
    				    <input type="submit" value="Delete" onclick="return confirm('Are you sure?');" />
                    <% } %>
				</td>
			</tr>
		<%} %>
    </table>

    <p><%= Html.ActionLink<ResumesController>(c => c.Create(), "Create New Resume") %></p>
</asp:Content>
